/**
 * 横幅相关API接口
 */

import type { BannerRespVO, GetBannersParams } from './types/banner'
import type { ApiResponse } from './types/common'
import { http } from '@/utils/request'

/**
 * 获取有效横幅列表
 * @param params 查询参数
 * @returns 横幅列表
 */
export function getActiveBanners(params?: GetBannersParams): Promise<ApiResponse<BannerRespVO[]>> {
  return http.get('/reading/banners/active', {
    params,
  })
}

/**
 * 记录横幅点击
 * @param id 横幅ID
 * @returns 操作结果
 */
export function recordBannerClick(id: number): Promise<ApiResponse<boolean>> {
  return http.post(`/reading/banners/click/${id}`)
}
